<template>
  <div class="container">
    <router-view></router-view>
    <footer class="footer" v-if="!$route.meta.hidden">
      <ul>
        <router-link to="/home" tag="li">
          <span class="iconfont icon-shouye"></span>
          <p>首页</p>
        </router-link>
        <router-link to="/kind" tag="li">
          <span class="iconfont icon-fenlei"></span>
          <p>分类</p>
        </router-link>
        <router-link to="/cart" tag="li">
          <span class="iconfont icon-gouwuche"></span>
          <p>购物车</p>
        </router-link>
        <router-link v-if="isLogin" to="/user" tag="li">
          <span class="iconfont icon-wodeguanzhu"></span>
          <p>我的</p>
        </router-link>
        <router-link v-else to="/login" tag="li">
          <span class="iconfont icon-wodeguanzhu"></span>
          <p>未登录</p>
        </router-link>
      </ul>
    </footer>
    <div class="tip">请将屏幕竖向浏览</div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed: {
    ...mapState({
      isLogin: state => state.user.isLogin
    })
  }
}
</script>

<style lang="stylus">
*
  padding 0
  margin 0
  list-style none

@font-face {
  font-family: "iconfont"; /* Project id 2867560 */
  src: url('https://at.alicdn.com/t/font_2867560_s94v9bdlx3e.woff2?t=1634192797928') format('woff2'),
       url('https://at.alicdn.com/t/font_2867560_s94v9bdlx3e.woff?t=1634192797928') format('woff'),
       url('https://at.alicdn.com/t/font_2867560_s94v9bdlx3e.ttf?t=1634192797928') format('truetype');
}

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-shouye:before {
  content: "\e64f";
}

.icon-gouwuche:before {
  content: "\e899";
}

.icon-fenlei:before {
  content: "\e71b";
}

.icon-wodeguanzhu:before {
  content: "\e8bc";
}

html
  // font-size 100px // 为了方便计算
  // iphone6 750 * 1334 ==> 375 * 667
  // 100 / 375 * 100
  // * 100 为了好计算
  font-size 26.666667vw // iphone6
@media all and (min-width: 996px)
  html
    font-size 100px

body
  font-size 14px // 根据设计师给的设计稿的基础字体的大小
html, body, .container
  height 100%
.container
  max-width 996px
  margin 0 auto
  display flex
  flex-direction column
  .box
    flex 1
    overflow auto
    display flex
    flex-direction column
    .header
      height 0.44rem
      background-color #f66
    .content
      flex 1
      overflow auto
  .footer
    height 0.5rem
    background-color #efefef
    ul
      width 100%
      height 100%
      display flex
      li
        flex 1
        height 100%
        display flex
        flex-direction column
        justify-content center
        align-items center

        &.router-link-active
          color #f66

        span
          font-size 0.24rem
        p
          font-size 12px
.tip
  position fixed
  top 0px
  left 0px
  right 0px
  bottom 0px
  background-color rgba(0, 0, 0, 0.6)
  color #fff
  display none
  justify-content center
  align-items center

// 如何判断是横屏还是竖屏  ---  媒体查询
@media all and (orientation : landscape)
  .tip
    display flex
</style>
